package com.cai.oamanager.service.impl;

import com.cai.oamanager.dao.MessageDao;
import com.cai.oamanager.entity.Message;
import com.cai.oamanager.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @version 1.0
 * @author：蔡松坡
 * @date：2021/1/18 22 : 03
 * @package：com.cai.oamanager.service.impl
 */
@Service
public class MessageServiceImpl implements MessageService {
    @Autowired
    private MessageDao messageDao;
    @Override
    public List<Message> getSendMessage(String reciver, String sender, Integer start, Integer size) {
        return messageDao.getSendMessage(reciver,sender,start,size);
    }

    @Override
    public Message getSendMessageById(Integer mid) {
        return messageDao.getSendMessageById(mid);
    }

    @Override
    public void deleteSendMessage(Integer mid) {
        messageDao.deleteSendMessage(mid);
    }

    @Override
    public Integer getSendCountMessage(String sender) {
        return messageDao.getSendCountMessage(sender);
    }

    @Override
    public void sendMessage(Message message) {
        messageDao.sendMessage(message);
    }

    @Override
    public List<Message> getReciverMessage(String reciver,Integer pid, String sender, Integer start, Integer size) {

        return messageDao.getReciverMessage(reciver,pid,sender,start,size);
    }

    @Override
    public Message getReciverMessageById(Integer mid) {
        return messageDao.getReciverMessageById(mid);
    }

    @Override
    public Integer getReciverCountMessage(String reciver) {
        return messageDao.getReciverCountMessage(reciver);
    }

    @Override
    public int getNewMessageCount(String oid, Integer opsitionid) {
        return messageDao.getNewMessageCount(oid,opsitionid);
    }

    @Override
    public int getNewReciveMessageCount(String oid, Integer opsitionid) {
        return messageDao.getNewReciveMessageCount(oid,opsitionid);
    }

    @Override
    public void updateState(Integer mid) {
        messageDao.updateState(mid);
    }

    @Override
    public void updateCount(Integer count, Integer mid) {
        messageDao.updateCount(count,mid);
    }

}
